package concurrent;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

public class BlockingQueueExample {

	private static final BlockingQueue<String> queue = new LinkedBlockingQueue<String>(5);

	private static Thread producer1 = new Thread(new Producer("pro1", queue));
	private static Thread producer2 = new Thread(new Producer("pro2", queue));

	private static Thread consumer1 = new Thread(new Consumer("con1", queue));
	private static Thread consumer2 = new Thread(new Consumer("con2", queue));
	
	public static void startProcess(){
		producer1.start();
		consumer1.start();
		producer2.start();
		consumer2.start();
	}
	

	// main method
	public static void main(String[] args){
		startProcess();
	}
}
